
<?php
include("header.php");

// Connect to server and select databse.
mysql_connect(DBADDR, DBUSER, DBPWD)or die("cannot connect");
mysql_select_db(DBNAME)or die("cannot select DB");
mysql_query('set names utf8'); 
$resto_id = $_POST["selectedid"];
$sql = "SELECT * from info_resto WHERE RESTO_ID='".$resto_id."'";
$rs_result = mysql_query ($sql);
if (!$rs_result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}

$row = mysql_fetch_assoc($rs_result);

$namefr = $row['RESTO_NAME_FR'];
$namearb = $row['RESTO_NAME_ARB'];
$restoredu = $row['RESTO_REDU'];
$restotype = $row['RESTO_TYPE_ID'];
$restonation = $row['RESTO_NATION'];
$tel = $row['RESTO_TEL'];
$address = $row['RESTO_ADDR'];
$mail = $row['RESTO_MAIL'];
$descfr = $row['RESTO_INTRO_FR'];
$descarb = $row['RESTO_INTRO_ARB'];
$opentimefr = $row['RESTO_TIME_FR'];
$opentimearb = $row['RESTO_TIME_ARB'];
$hasreserv = $row['HAS_RESERV'];
$hascoupon = $row['HAS_COUPON'];
$intropic = $row['INTRO_PIC'];
$website = $row['RESTO_WEBSITE'];

?>
	
	<!--  start page-heading -->
<div id="page-heading">
<h1>Edit restaurant </h1>
</div>
<!-- end page-heading -->
<form id="resto_infomation" action="editrestotodb.php"  enctype="multipart/form-data"   method="post">
<input type="hidden" value="<?=$resto_id?>" name="selectedid" id="selectedid"/>	
		<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
	<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
	<th class="topleft"></th>
	<td id="tbl-border-top">&nbsp;</td>
	<th class="topright"></th>
	<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
	<td id="tbl-border-left"></td>
	<td>
	<!--  start content-table-inner -->
	<div id="content-table-inner">
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<tr valign="top">
	<td>
	
		<!-- start id-form -->
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		
			
		
		<tr>
			<th valign="top">Resto name FR:</th>
			<td><input type="text" class="inp-form" id="namefr" name="namefr" value="<?=$namefr?>"/></td>
			<td></td>
		</tr>
		<tr>
			<th valign="top">Resto name ARB:</th>
			<td><input type="text" class="inp-form" id="namearb" name="namearb" value="<?=$namearb?>"/></td>
			<td>
			</td>
		</tr>
		<tr>
	<th>Introduce Picture</th>
	<td><input type="file" class="file_1" name="intro_pic" name="intro_pic"/></td>
	<td>
	<?php if($intropic!=""){echo "<img height='200' width='230' src='../".$intropic."'/>";}?>
	<div class="bubble-left"></div>
	<div class="bubble-inner">JPEG, GIF 5MB max per image</div>
	<div class="bubble-right"></div>
	</td>
	</tr>
		<tr>
			<th valign="top">Resto reduction:</th>
			<td><input type="text" class="inp-form" id="restoredu" name="restoredu"  value="<?=$restoredu?>"/></td>
			<td>
			</td>
		</tr>
		<tr>
		<th valign="top">Type:</th>
		<td>
<?php

$sql = "SELECT * from type_resto";
$rs_result = mysql_query ($sql);
?>		
		<select  class="styledselect_form_1" id="restotype" name="restotype">
		<?php
while ($row = mysql_fetch_assoc($rs_result)) { 
	?>
	<option value="<?php echo $row['TYPE_ID']; ?>"  <?php if($row['TYPE_ID']==$restotype) echo "selected='selected'"?>><?php echo $row['TYPE_NAME_FR']?></option>
	<?php
};
?> 
		</select>
		</td>
		<td></td>
		</tr>
		<tr>
		<th valign="top">Nation:</th>
		<td>	
		<select  class="styledselect_form_1" id="restonation" name="restonation">
		<?php
		
		$sql = "SELECT * from nation_name";
		$rs_result = mysql_query ($sql);
		while ($row = mysql_fetch_assoc($rs_result)) {
		?>
<option value="<?php echo $row['NATION_ID']; ?>"   <?php if($row['NATION_ID']==$restonation) echo "selected='selected'"?>><?php echo $row['NATION_NAME_FR']?></option>
				<?php
};
?> 
		</select>
		</td>
		<td></td>
		</tr> 
		<tr>
			<th valign="top">Tel:</th>
			<td><input type="text" class="inp-form" id="tel" name="tel"  value="<?=$tel?>"/></td>
			<td></td>
		</tr>
		<tr>
		<th valign="top">Address</th>
		<td><input type="text" class="inp-form" id="address" name="address"  value="<?=$address?>" /></td>
		<td></td>
	</tr>
	<tr>
		<th valign="top">Mail</th>
		<td><input type="text" class="inp-form" id="mail" name="mail"  value="<?=$mail?>"/></td>
		<td></td>
	</tr>
	<tr>
		<th valign="top">Description FR:</th>
		<td><textarea rows="" cols="" style="resize:none" class="form-textarea" id="descfr" name="descfr" ><?=$descfr?></textarea></td>
		<td></td>
	</tr>
	<tr>
		<th valign="top">Description ARB:</th>
		<td><textarea rows="" cols="" style="resize:none" class="form-textarea" id="descarb" name="descarb"><?=$descarb?></textarea></td>
		<td></td>
	</tr>
	<tr>
		<th valign="top">Website</th>
		<td><input type="text" class="inp-form" id="website" name="website"  value="<?=$website?>"/></td>
		<td></td>
	</tr>
		<tr>
		<th valign="top">Open time FR</th>
		<td><input type="text" class="inp-form" id="opentimefr" name="opentimefr"  value="<?=$opentimefr?>"/></td>
		<td></td>
	</tr>
		<tr>
		<th valign="top">Open time ARB</th>
		<td><input type="text" class="inp-form" id="opentimearb" name="opentimearb"  value="<?=$opentimearb?>"/></td>
		<td></td>
	</tr>
		<tr>
		<th valign="top">Has coupon</th>
		<td><input type="checkbox" name="hascoupon" id="hascoupon" <?php if($hascoupon){echo "checked='true'";} ?>/></td>
		<td></td>
	</tr>
		<tr>
		<th valign="top">Can be reserved</th>
		<td><input type="checkbox" name="hasreserv" id="hasreserv" <?php if($hasreserv){echo "checked='true'";} ?>/></td>
		<td></td>
	</tr>
	
	
	<tr>
		<th>&nbsp;</th>
		<td valign="top">
			<input type="submit" value="" class="form-submit" />
			<input type="button" value="" class="form-return"  onclick="window.location.href='allresto.php'"  />
		</td>
		<td></td>
	</tr>
	</table>
	<!-- end id-form  -->

	</td>
	<td>

</td>
</tr>
<tr>
<td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
<td></td>
</tr>
</table>
</form>
 
<div class="clear"></div>
 

</div>
<!--  end content-table-inner  -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
	<th class="sized bottomleft"></th>
	<td id="tbl-border-bottom">&nbsp;</td>
	<th class="sized bottomright"></th>
</tr>
</table>



<div class="clear">&nbsp;</div>

</div>
<!--  end content -->
<div class="clear">&nbsp;</div>
</div>
<!--  end content-outer -->

 

<div class="clear">&nbsp;</div>
    